package cn.basic.service.impl;

import cn.basic.bean.resp.DownloadResultData;
import cn.basic.bean.resp.QueryStatusResultData;
import cn.basic.bean.resp.ReportResultData;
import cn.basic.bean.vo.RequestParamsVo;
import cn.basic.service.IRecordService;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.UUID;

/**
 * @description:
 * @author: ZZZ
 * @time: 2021/2/24 9:12
 */
@Service
public class RecordService implements IRecordService {
    private static String pdfData="DQogIEV2YWx1YXRpb24gV2FybmluZyA6IFRoZSBkb2N1bWVudCB3YXMgY3JlYXRlZCB3aXRoIFNwaXJlLlBERiBmb3IgSmF2YS4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIOa7tOa7tOWHuuihjOKAlOihjOeoi+WNlQ0KDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERJREkgVFJBVkVMIC0gVFJJUCBUQUJMRQ0KDQoNCg0KICAgICAgICAgICAg44CA5aeT5ZCN77ya44CAX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f44CA5bel5Y+377ya44CAX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f44CA6YOo6Zeo77ya44CAX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fDQoNCg0KDQogICAgICAgICAgICAgIOeUs+ivt+aXpeacnzoyMDIwLTA1LTIzICAgICAgICAgICAgICAgICAgICAgICAgICAgICDooYznqIvotbfmraLml6XmnJ86MjAyMC0wNS0wNiDoh7MgMjAyMC0wNS0yMg0KICAgICAgICAgICAgICDooYznqIvkurrmiYvmnLrlj7c6MTgwNjU4NTUzNzYgICAgICAgICAgICAgICAgICAgICAgICDlhbEy56yU6KGM56iL77yMIOWQiOiuoSA2Ny45MuWFgw0KDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIOmHjOeoiyAgICAgICDph5Hpop0NCiAgICAgICAgICAgICAg5bqP5Y+3ICAg6L2m5Z6LICAgICAg5LiK6L2m5pe26Ze0ICAgICAgICAgIOWfjiDluIIgICAgICAgICAgICAgICAgICDotbfngrkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg57uI54K5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDlpIfms6gNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBb5YWs6YeMXSAgICAgICBb5YWDXQ0KDQogICAgICAgICAgICAgICAxICAgICDlv6vovaYgICAwNS0wNiAxNToyNyDlkajkuIkgICAgIOa3seWcs+W4giAgICAgICAgIOWNl+W5v+Wcui3ljZfkvqct5YWs5Lqk56uZ54mM5aSEICAgICAgICAgICAgICAgICAg5Yib5a+TKOWkp+i/kOW6lykgICAgICAgICAgICAgICAxMy4yICAgICAgIDMzLjYwDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgDQoNCiAgICAgICAgICAgICAgIDIgICAgIOW/q+i9piAgIDA1LTIyIDExOjAyIOWRqOS6lCAgICAg5rex5Zyz5biCICAgICAgICAgICAgICDliJvlr5Mo5aSn6L+Q5bqXKSAgICAgICAgICAgICAgICAgICAgICAgIOa3seWcs+WdquWxseermSAgICAgICAgICAgICAgICAxMi4zICAgICAgIDM0LjMyDQoNCg0KDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg6aG156CB77yaMS8xDQoNCg==";
    private static HashSet set=new HashSet<String>();
    @Override
    public ReportResultData report(RequestParamsVo requestParamsVo) {
        ReportResultData resultData=new ReportResultData();
        String uuid= UUID.randomUUID().toString().replaceAll("-","");
        resultData.setBusinessNumber(uuid.substring(0,20));
        set.add(resultData.getBusinessNumber());
        return resultData;
    }

    @Override
    public QueryStatusResultData queryStatus(RequestParamsVo requestParamsVo) {
        QueryStatusResultData resultData=new QueryStatusResultData();
        if(set.contains(requestParamsVo.getBusinessNumber())){
            resultData.setKey("0");
            resultData.setValue("是");
            return resultData;
        }
        return null;
    }

    @Override
    public DownloadResultData download(RequestParamsVo requestParamsVo) {


        DownloadResultData resultData=new DownloadResultData();
        if(set.contains(requestParamsVo.getBusinessNumber())){
            resultData.setIdNumber(requestParamsVo.getIdNumber());
            resultData.setData(pdfData);
            return resultData;
        }
        return null;
    }
}
